package br.com.nooclix.salon.controller;

import java.util.Calendar;
import java.util.List;

import br.com.nooclix.salon.application.AttendanceSheetApplication;
import br.com.nooclix.salon.controller.util.ResponseData;
import br.com.nooclix.salon.domain.attendance.ReportAttendance;
import br.com.nooclix.salon.domain.employee.Employee;
import br.com.nooclix.salon.infrastructure.util.ApplicationContextRegister;

public class ReportController {
	private AttendanceSheetApplication attendanceSheetRepositoryImpl = ApplicationContextRegister
		.getBean("attendanceSheetApplication", AttendanceSheetApplication.class);
	
	
	public ResponseData findReportEmployeeAndPeriod(Employee employee, Calendar dateStart,Calendar dateEnd){
		
		ResponseData responseData = new ResponseData();
		try{ 
			
			List<ReportAttendance> repAttendance = attendanceSheetRepositoryImpl.findReportEmployeeAndPeriod(employee, dateStart, dateEnd);
			
			responseData.setItems(repAttendance);
			responseData.setStatus(ResponseData.OK);
			
		}catch (Exception e) {
			e.printStackTrace();
			responseData.setMessage(e.getMessage());
			responseData.setStatus(ResponseData.FAILED);
		}
		
		return responseData;
		
	}
	
	/*public ResponseData listAttendance() {
		ResponseData responseData = new ResponseData();

		try {
			
			List<AttendanceSheet> att = attendanceSheetRepositoryImpl.list();
			List<Attendance> attendance = new java.util.ArrayList<Attendance>();
			for (AttendanceSheet attendanceSheet : att) {
				attendance = attendanceSheet.getAttendance();
			}
			responseData.setItems(attendance);
			responseData.setStatus(ResponseData.OK);
		} catch (Exception e) {
			e.printStackTrace();
			responseData.setMessage(e.getMessage());
			responseData.setStatus(ResponseData.FAILED);
		}
		return responseData;

	}
*/}
